/*
 * Created: 2022-08-31 20:34:41
 * Author : 涛涛涛
 */

/** 倒计时,截止时间 */
export const figureDownTime = (startStamp: number, endStamp: number) => {
    if (typeof endStamp !== 'number' || typeof startStamp !== 'number') {
        return {
            hour: '00',
            minute: '00',
            second: '00',
        };
    }
    const downTimeAllSecond = (endStamp - startStamp) / 1000;
    // 计算出时分秒
    const h: string = String(parseInt((downTimeAllSecond / 60 / 60) as any)).padStart(2, '0'); //时
    const m: string = String(parseInt(((downTimeAllSecond / 60) % 60) as any)).padStart(2, '0'); // 分
    const s: string = String(parseInt((downTimeAllSecond % 60) as any)).padStart(2, '0'); // 当前的秒
    return {
        hour: h,
        minute: m,
        second: s,
    };
};
